Garbage Collection

Automatic Reference Counting (ARC)

  • The object has a field that represents the object's count.

  • Expensive.

  • There are checks every time the object is modified.

  • Cycles are problematic.

Mark and Sweep

  • Has no problems with cycles.

  • There's no need to check every time the object is modified, but the checks are done during the GC Pause, which is where the GC pauses the app to look for garbage.